<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<div class="t_bar">总投资规模，资金筹措方案，保障措施（万元）</div>
	<table cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
		<col width="5%"/>
		<col width="35%"/>
		<col width="20%"/>
		<col width="20%"/>
		<col width="20%"/>
			<tr style="border:1px solid #B7D1E6">
				<th class="TblHead" align="center">序号</th>
				<th class="TblHead" align="center">经费来源 </th> 
				<th class="TblHead" align="center"><x:out select="$xmlData/data/investmenttotals/stat_year_one_value"/>年</th>  
				<th class="TblHead" align="center"><x:out select="$xmlData/data/investmenttotals/stat_year_two_value"/>年</th> 
				<th class="TblHead" align="center"><x:out select="$xmlData/data/investmenttotals/stat_year_three_value"/>年</th> 
			</tr> 
				<tr  align="center">
						<td align="center" rowspan="2" colspan="1">&nbsp;
							/
						<td >
						<span name="investmenttotals/investmenttotal1/source_name">依托单位自筹</span>
						</td>
						<td >
							<x:out select="$xmlData/data/investmenttotals/investmenttotal1/year_one"/>
						</td>
						<td >
						 <x:out select="$xmlData/data/investmenttotals/investmenttotal1/year_two"/>
						</td>
						<td >
						 <x:out select="$xmlData/data/investmenttotals/investmenttotal1/year_three"/>
						</td>
					</tr>
					<tr  align="center">
						<td >
						<span name="investmenttotals/investmenttotal2/source_name">银行贷款</span>
						</td>
						<td >
						 <x:out select="$xmlData/data/investmenttotals/investmenttotal2/year_one"/>
						</td>
						<td >
						 <x:out select="$xmlData/data/investmenttotals/investmenttotal2/year_two"/>
						</td>
						<td >
						 <x:out select="$xmlData/data/investmenttotals/investmenttotal2/year_three"/>
						</td>
					</tr>
		</table>
	<table  id="tblInvestmentTotal" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
		<col width="5%"/>
		<col width="35%"/>
		<col width="20%"/>
		<col width="20%"/>
		<col width="20%"/>
		<tbody id="tab">
		<c:set value="0" var="index" scope="page"/>
			<x:forEach select="$xmlData/data/investmenttotals/investmenttotal" var="attendorg">
			
			<c:choose>
				<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
				<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
			</c:choose>
			<tr  align="center">
				<td align="center">
					<span   name="investmenttotals/investmenttotal[${flag}${index}]@seq_no" ><x:out select="$attendorg/@seq_no"/></span> 
				</td>
				<td >
				 <x:out select="$attendorg/source_name"/>
				</td>
				<td >
				 <x:out select="$attendorg/year_one"/>
				</td>
				<td >
				 <x:out select="$attendorg/year_two"/>
				</td>
				<td >
				 <x:out select="$attendorg/year_three"/> 
				</td>
		   </tr>
			<c:set value="${index+1}" var="index" scope="page"/>
			</x:forEach>
		</tbody>
	</table>
	<table cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<col width="5%"/>
			<col width="35%"/>
			<col width="20%"/>
			<col width="20%"/>
			<col width="20%"/>
		<tr  align="center">
			<td align="center"  colspan="1">&nbsp; /</td>
			<td >
				<span name="investmenttotals/investmenttotalsum/source_name">总计</span>
			</td>
			<td colspan="3">
				 <x:out select="$xmlData/data/investmenttotals/investmenttotalsum/year_total"/>
			</td>
		</tr>
	</table>
	<br/>
<br/>
<div class="t_bar">资金支出预算（万元）</div>	
<table  id="tblOutPutBudget" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
	<col width="5%"/>
	<col width="30%"/>
	<col width="30%"/>
	<col width="35%"/>
	<thead >
		<tr >
			<th class="TblHead" align="center" >序号</th>
			<th class="TblHead" align="center" >支出科目</th> 
			<th class="TblHead" align="center"  >支出金额</th>  
			<th class="TblHead" align="center"  >备注</th> 
		</tr>
	</thead>
	<tbody id="tab">
		
	<c:set value="0" var="index" scope="page"/>
		<x:forEach select="$xmlData/data/outputbudgets/outputbudget" var="attendorg">
		
		<c:choose>
			<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
			<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
		</c:choose>
		<tr  >
			<td align="center">
				<span   name="outputbudgets/outputbudget[${flag}${index}]@seq_no" ><x:out select="$attendorg/@seq_no"/></span> 
			</td>
			<td >
			 <x:out select="$attendorg/out_subject"/>
			</td>
			<td align="center">
			 <x:out select="$attendorg/out_price"/>
			</td>
			<td >
			 <x:out select="$attendorg/out_remark"/>
			</td>
			</tr>
		<c:set value="${index+1}" var="index" scope="page"/>
		</x:forEach>
	</tbody>
</table>
<table cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
	<col width="5%"/>
	<col width="30%"/>
	<col width="30%"/>
	<col width="35%"/>
	<tr  align="center">
		<td align="center"  colspan="1">&nbsp; /</td>
		<td >
		<span name="outputbudgets/outputbudgetsum/out_subject">总计</span>
		</td>
		<td colspan="2">
		<x:out select="$xmlData/data/outputbudgets/outputbudgetsum/out_price"/>
		</td>
	</tr>
</table>
	<br/>
<div class="t_bar">
	<span class="color_red">*</span>其中： 研究开发经费支出预算（万元）
</div>
<table class="t_css" width="100%" border="0" cellpadding="0"
	cellspacing="1" id="fundInfo">

	<tr class="t_tr">
		<td align="center" width="25%">支出科目</td>
		<td class="TblHead" align="center" width="20%">总预算</td>
	</tr>
	<tr >
		<td align="left" style=""><strong>一、直接费用</strong></td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='00']/total_invest" />
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:20px">1、设备费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='01']/total_invest" />
		</td>
	
	</tr>
	<tr >
		<td align="left" style="padding-left:40px">（1）购置设备费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='02']/total_invest" />
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:40px">（2）自制设备费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='03']/total_invest" />
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:40px">（3）设备改造与租赁</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='04']/total_invest" />
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:20px">2、材料费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='05']/total_invest" /> 
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:20px">3、测试化验加工费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='06']/total_invest" /> 
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:20px">4、燃料动力费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='07']/total_invest" /> 
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:20px">5、差旅费/会议费/国际合作与交流费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='08']/total_invest" /> 
		</td>
	</tr>
	<%-- <tr >
		<td align="left" style="padding-left:20px">6、会议费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='09']/total_invest" /> 
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:20px">7、国际合作与交流费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='10']/total_invest" /> 
		</td>
	</tr>
	<tr > --%>
		<td align="left" style="padding-left:20px">6、信息费（出版/文献/信息传播<br/>&nbsp;&nbsp;&nbsp;&nbsp;/知识产权事物费）</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='11']/total_invest" /> 
		</td>
	</tr>
	
	
	<tr >
		<td align="left" style="padding-left:20px">7、专家咨询费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='12']/total_invest" /> 
		</td>
	</tr>
	
	<tr >
		<td align="left" style="padding-left:20px">8、劳务费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='13']/total_invest" /> 
		</td>
	</tr>
	
	<tr >
		<td align="left" style="padding-left:20px">9、其他支出</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='14']/total_invest" /> 
		</td>
	</tr>
	
	<tr >
		<td align="left" style=""><strong>二、间接费用</strong></td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='15']/total_invest" />
		</td>
	</tr>
	<tr >
		<td align="left" style="padding-left:20px">1、管理费</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='16']/total_invest" />
		</td>
	</tr>
	
	<tr >
		<td align="left" style="padding-left:20px">2、绩效支出</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='17']/total_invest" />
		</td>
	</tr>
	
	<tr >
		<td align="left" style="padding-left:20px">3、其他</td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='19']/total_invest" />
		</td>
	</tr>
	<tr >
		<td align="left" ><strong>合计</strong></td>
		<td align="center">
			 <x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='18']/total_invest" /> 
		</td>
	</tr>
</table>

<div class="t_bar">其中：拟添置的仪器设备经费预算</div>	
<table  id="tblEquipmentBudget" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
		<col width="5%"/>
		<col width="20%"/>
		<col width="10%"/>
		<col width="10%"/>
		<col width="20%"/>
		<col width="10%"/>
		<col width="10%"/>
		<thead >
			<tr style="border:1px solid #B7D1E6">
				<th class="TblHead" align="center"  >序号</th>
				<th class="TblHead" align="center"  >设备名称  </th> 
				<th class="TblHead" align="center" >型号</th>  
				<th class="TblHead" align="center"  >数量</th> 
				<th class="TblHead" align="center"  >主要用途</th>
				<th class="TblHead" align="center"  >添置方式</th>
				<th class="TblHead" align="center"  >经费预算（万元）</th>  
			</tr>
		</thead>
		<tbody id="tab">
			
		<c:set value="0" var="index" scope="page"/>
			<x:forEach select="$xmlData/data/equipmentbudgets/equipmentbudget" var="attendorg">
			
			<c:choose>
				<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
				<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
			</c:choose>
			<tr  >
				<td align="center">
					<span   name="equipmentbudgets/equipmentbudget[${flag}${index}]@seq_no" ><x:out select="$attendorg/@seq_no"/></span> 
				</td>
				<td >
			 <x:out select="$attendorg/equipment_name"/>
				</td>
				<td >
				 <x:out select="$attendorg/equipment_type"/>
				</td>
				<td align="center">
				 <x:out select="$attendorg/equipment_count"/>
				</td>
				<td >
				 <x:out select="$attendorg/equipment_purpose"/>
				</td>
				<td align="center">
				 <x:out select="$attendorg/acquire_way_name"/>
				</td>
				<td align="center">
				 <x:out select="$attendorg/equipment_price"/>
				</td>
				</tr>
			<c:set value="${index+1}" var="index" scope="page"/>
			</x:forEach>
		</tbody>
	</table>
	<p>注：添置方式分为：国外引进、国内购置、自行研制。</p>
	<br/>
<script type="text/javascript">
$(document).ready(function() {
var prp_version=$("#prp_version").text();

if(prp_version==""||prp_version==null){
	$("#budgetsMsg").find(":input").each(function(){
	$(this).val("0.00");	
	});
	
	$("#budgetsMsg1").find(":input").each(function(){
		$(this).val("0.00");	
		});
	
	$("#budgetsMsg2").find(":input").each(function(){
		$(this).val("0.00");	
		});
	
	$("#fundAdds").find(":input[type!=hidden]").each(function(){
		$(this).val("0.00");	
		});
}

/* var flag_shizhi = $("#flag_shizhi").val();
if(flag_shizhi ==  1){
	$("#source_city").attr("disabled",true);
    $("#source_city").addClass("gray");
}else{ */
	$("#source_city").attr("disabled",false);
/* 	$("#source_area").attr("disabled",true);
	$("#source_city").addClass("gray");
	$("#source_area").addClass("gray"); */
/* } */
	
});

function synchro(){
	var val = $("#source_apply").val();
	var xmjhtzze = $("#source_total").val();
	$("#sqje").val(formatNumberAuto(val+"", 7, 4, 2));
	$("#xmjhtzze").val(formatNumberAuto(xmjhtzze+"", 7, 4, 2));
}

function setSource(val){
	var areaNo = $("input[name$='area_no']").val();
	var flag_shizhi = $("#flag_shizhi").val();
	if(flag_shizhi ==  1){
		if((formatNumberAuto(val+"", 7, 4, 2)*10000)%10000!=0)
			$("#source_city").val(formatNumberAuto(val+"0000", 7, 4, 2));
		else
			$("#source_city").val(formatNumberAuto(val+".0000", 7, 4, 2));
		$("#source_area").val("0.00");
	}else{
		if(areaNo == '320202' || areaNo == '320204' || areaNo == '320203'){
			
		if((formatNumberAuto(val*0.8+"", 7, 4, 2)*10000)%10000!=0)
			$("#source_city").val(formatNumberAuto(val*0.8+"0000", 7, 4, 2));
		else
			$("#source_city").val(formatNumberAuto(val*0.8+".0000", 7, 4, 2));
		
		
		if((val*10000-formatNumberAuto(val*0.8+"", 7, 4, 2)*10000)%10000!=0){
		 	$("#source_area").val(formatNumberAuto(((val*10000-formatNumberAuto(val*0.8+"", 7, 4, 2)*10000)/10000)+"0000", 7, 4, 2));
		}else{
			$("#source_area").val(formatNumberAuto(((val*10000-formatNumberAuto(val*0.8+"", 7, 4, 2)*10000)/10000)+".0000", 7, 4, 2));
		}
		}else if(areaNo == '320205' || areaNo == '320206' || areaNo == '320211' || areaNo == '320212'){
			//$("#source_city").val(formatNumberAuto(val*0.5+"", 7, 4, 2));
			if((formatNumberAuto(val*0.5+"", 7, 4, 2)*10000)%10000!=0)
				$("#source_city").val(formatNumberAuto(val*0.5+"0000", 7, 4, 2));
			else
				$("#source_city").val(formatNumberAuto(val*0.5+".0000", 7, 4, 2));
			
			if((val*10000-formatNumberAuto(val*0.5+"", 7, 4, 2)*10000)%10000!=0){
				$("#source_area").val(formatNumberAuto(((val*10000-formatNumberAuto(val*0.5+"", 7, 4, 2)*10000)/10000)+"0000", 7, 4, 2));
			}else
				$("#source_area").val(formatNumberAuto(((val*10000-formatNumberAuto(val*0.5+"", 7, 4, 2)*10000)/10000)+".0000", 7, 4, 2));
		}else if(areaNo == '320281' || areaNo == '320282'){
			//$("#source_city").val(formatNumberAuto(val*0.2+"", 7, 4, 2));
			if((formatNumberAuto(val*0.2+"", 7, 4, 2)*10000)%10000!=0)
				$("#source_city").val(formatNumberAuto(val*0.2+"0000", 7, 4, 2));
			else
				$("#source_city").val(formatNumberAuto(val*0.2+".0000", 7, 4, 2));
			if((val*10000-formatNumberAuto(val*0.2+"", 7, 4, 2)*10000)%10000!=0){
				$("#source_area").val(formatNumberAuto(((val*10000-formatNumberAuto(val*0.2+"", 7, 4, 2)*10000)/10000)+"0000", 7, 4, 2));
			}else{
				$("#source_area").val(formatNumberAuto(((val*10000-formatNumberAuto(val*0.2+"", 7, 4, 2)*10000)/10000)+".0000", 7, 4, 2));
				
			}
		}
	}
}

function  countProvince(id1,id2){
	var val1 = $("#"+id1).val();
	if(!$.isNumeric(val1)){
		val1 = '';
	}
	$("#"+id2).val(formatNumberAuto(val1+".0000", 7, 4, 2));
}

/* function countFundAuto() {
	$("input[]").each(function(){
		
	})
	
	var indexs = countStr.split(",");
	var count = 0;
	for ( var i = 0; i < indexs.length; i++) {
		var fund = $("#" + idStart + indexs[i]).val();
		if (!$.isNumeric(fund))
			fund = "0";
		count = ((parseFloat(count)*10000 + parseFloat(fund)*10000)/10000).toFixed(4);
	}
	count = formatNumberAuto(count.toString(), 9, 4, 2);// 格式化金额
	//add by cg 扩展：对于多个输入框所求得的和，同时赋给某几个文本框
	var totalStrArr = totalStr.split(",");
	var totalId;
	for(var i = 0;i < totalStrArr.length; i++ ) {
		totalId = totalStrArr[i];
	$("#" + idStart + totalId).val(count);
	}
} */
function computeSum(compute){
	var count = 0;
	$("input[compute='"+compute+"subitem']").each(function(){
		var fund = $(this).val();
		if (!$.isNumeric(fund))
			fund = "0";
		count = ((parseFloat(count)*10000 + parseFloat(fund)*10000)/10000).toFixed(4);
	})
	count = formatNumberAuto(count.toString(), 9, 4, 2);
	$("input[compute='"+compute+"total']").val(count);
}
</script>
